import request from '../utils/request.js'

export function getArticles(params){
  return request({
    method:'GET',
    url:'/v1_0/articles',
    params
  })
}

export function getArticleById(articleId){
  return request({
    method:'GET',
    url:`/v1_0/articles/${articleId}`
  })
}

//收藏请求
export function addCollect(target){
  return request({
    method:'post',
    url:'/v1_0/article/collections',
    data:{
      target
    }
  })
}

//取消收藏
export function delCollect(target){
  return request({
    method:'DELETE',
    url:`/v1_0/article/collections/${target}`,
  })
}

//点赞爱你哟

export function addlikings(target){
  return request({
    method:'post',
    url:'/v1_0/article/likings',
    data:{
      target
    }
  })
}
//取消点赞 SB
export function dellikings(target){
  return request({
    method:'DELETE',
    url:`/v1_0/article/likings/${target}`,
  })
}

//请求评论列表数据
export function getComments(params){
  return request({
    method:'GET',
    url:'/v1_0/comments',
    params
  })
}